package main

import (
	"fmt"
)

func p(o interface{}) {
	fmt.Println(o)
}
func main() {
	ch := make(chan int)
	go func() {
		sum := 0
		for i := 1; i <= 1000; i++ {
			sum += i
		}
		ch <- sum
	}()
	go func() {
		sum := 0
		for i := 1; i <= 1000; i++ {
			sum += i
		}
		ch <- sum
	}()
	go func() {
		sum := 0
		for i := 1; i <= 1000; i++ {
			sum += i
		}
		ch <- sum
	}()
	go func() {
		sum := 0
		for i := 1; i <= 1000; i++ {
			sum += i
		}
		ch <- sum
	}()
	result := 0
	for i := 0; i < 5; i++ {
		result = result + (<-ch)
	}
	p(result)

}
